﻿<%@ Page Language="C#" AutoEventWireup="true" CodeFile="ManageImageLink.aspx.cs" Inherits="Manageweb_ManageLink_ManageImageLink" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
    <title>无标题页</title>
    
<link href="../images/css.css" rel="stylesheet" type="text/css" />
    
</head>
<body>
    <form id="form1" runat="server">
    <div>
        <table border="1" cellpadding="0" cellspacing="0" width="750">
            <tr>
                <td style="font-weight: bold; color: white; background-color: #507cd1; text-align: left">
                    &nbsp;管理图片链接
                    <asp:Label ID="LB_ID" runat="server" Visible="False"></asp:Label></td>
            </tr>
        </table>
        <br />
        <table width="750" border="1" cellspacing="0" cellpadding="0" id="TABLE_ModImage" runat="server">
          <tr>
            <td colspan="2" style="font-weight: bold; color: white; background-color: #507cd1; text-align: left">&nbsp;修改链接图片</td>
          </tr>
          <tr>
            <td style="width: 150px">&nbsp;修改图片</td>
            <td style="text-align: left">&nbsp;<asp:FileUpload ID="FU_ModImage" runat="server" />
                <asp:Button ID="Btn_ModImage" runat="server" Text="修改" ValidationGroup="Btn_ModImage" OnClick="Btn_ModImage_Click" />
                <asp:RequiredFieldValidator ID="RFV_FU_ModImage" runat="server" ControlToValidate="FU_ModImage"
                    Display="Dynamic" ErrorMessage="*" ValidationGroup="Btn_ModImage"></asp:RequiredFieldValidator></td>
          </tr>
        </table>
        <br />
        <table border="1" cellpadding="0" cellspacing="0" width="750" id="TABLE_Add_Mod" runat="server">
            <tr>
                <td colspan="2" style="font-weight: bold; color: white; background-color: #507cd1; text-align: left">
                    &nbsp;<asp:Label ID="LB_TableTitle" runat="server"></asp:Label></td>
            </tr>
            <tr>
                <td style="width:150px;">
                    &nbsp;链接图片</td>
                <td style="text-align: left">
                    &nbsp;<asp:Image ID="IMG_LinkImage" runat="server" Height="50px" Width="150px" /><asp:FileUpload ID="FU_Image" runat="server" />
                    <asp:RequiredFieldValidator ID="RFV_FU_Image" runat="server" ControlToValidate="FU_Image"
                        Display="Dynamic" ErrorMessage="*" ValidationGroup="Btn_Submit"></asp:RequiredFieldValidator>
                    <asp:Label ID="LB_Thumb" runat="server" Visible="False"></asp:Label></td>
            </tr>
            <tr>
                <td>
                    &nbsp;链接地址</td>
                <td style="text-align: left">
                    &nbsp;<asp:TextBox ID="TB_URL" runat="server" Width="190px"></asp:TextBox>
                    <asp:RegularExpressionValidator ID="RegularExpressionValidator1" runat="server" ControlToValidate="TB_URL"
                        Display="Dynamic" ErrorMessage="格式应为http://...." SetFocusOnError="True" ValidationExpression="http(s)?://([\w-]+\.)+[\w-]+(/[\w- ./?%&=]*)?"
                        ValidationGroup="Btn_Submit"></asp:RegularExpressionValidator><asp:RequiredFieldValidator
                            ID="RequiredFieldValidator2" runat="server" ControlToValidate="TB_URL" Display="Dynamic"
                            ErrorMessage="*" ValidationGroup="Btn_Submit"></asp:RequiredFieldValidator></td>
            </tr>
            <tr>
                <td>
                    &nbsp;选项</td>
                <td style="text-align: left">
                    &nbsp;<asp:CheckBox ID="CB_State" runat="server" Text="是否启用" /></td>
            </tr>
            <tr>
                <td colspan="2" style="font-weight: bold; color: white; background-color: #507cd1; text-align: center">
                    <asp:Button ID="Btn_Submit" runat="server" Text="提交" ValidationGroup="Btn_Submit" />&nbsp;<asp:Button
                        ID="Button2" runat="server" Text="取消" /></td>
            </tr>
        </table>
        <br />
        <asp:Label id="LB_ManageImgLink" runat="server" ForeColor="Red" Font-Size="Small" Font-Bold="True"></asp:Label>
        <table border="1" cellpadding="0" cellspacing="0" width="750">
            <tr>
                <td>
                    <asp:GridView ID="GV_ImgLinkList" runat="server" Width="100%" CellPadding="4" ForeColor="#333333" AllowPaging="True" AllowSorting="True" AutoGenerateColumns="False" DataKeyNames="Link_ID" DataSourceID="ODS_ImgLinkList">
                        <FooterStyle BackColor="#507CD1" Font-Bold="True" ForeColor="White" />
                        <RowStyle BackColor="#EFF3FB" />
                        <EditRowStyle BackColor="#2461BF" />
                        <SelectedRowStyle BackColor="#D1DDF1" Font-Bold="True" ForeColor="#333333" />
                        <PagerStyle BackColor="#2461BF" ForeColor="White" HorizontalAlign="Center" />
                        <HeaderStyle BackColor="#507CD1" Font-Bold="True" ForeColor="White" />
                        <AlternatingRowStyle BackColor="White" />
                        <Columns>
                            <asp:BoundField DataField="Link_ID" HeaderText="Link_ID" InsertVisible="False" ReadOnly="True"
                                SortExpression="Link_ID" Visible="False" />
                            <asp:TemplateField HeaderText="链接图片" SortExpression="Link_Image">
                                <ItemTemplate>
                                    <asp:Image ID="Image1" runat="server" Height="50px" ImageUrl='<%# FormatLinkImage(Eval("Link_Image")) %>'
                                        Width="150px" />
                                </ItemTemplate>
                            </asp:TemplateField>
                            <asp:TemplateField HeaderText="链接地址" SortExpression="Link_URL">
                                <ItemTemplate>
                                    <asp:HyperLink ID="HyperLink1" runat="server" NavigateUrl='<%# Eval("Link_URL") %>'
                                        Target="_blank" Text='<%# Eval("Link_URL") %>'></asp:HyperLink>
                                </ItemTemplate>
                            </asp:TemplateField>
                            <asp:TemplateField HeaderText="状态" SortExpression="Link_State">
                                <EditItemTemplate>
                                    <asp:CheckBox ID="CheckBox1" runat="server" Checked='<%# Bind("Link_State") %>' />
                                </EditItemTemplate>
                                <ItemTemplate>
                                    <asp:Button ID="Btn_State" runat="server" CommandArgument='<%# Eval("Link_ID") %>'
                                        OnCommand="Btn_State_Command" Text='<%# FormatState(Eval("Link_State")) %>' Width="55px" />
                                </ItemTemplate>
                            </asp:TemplateField>
                            <asp:TemplateField>
                                <ItemTemplate>
                                    <asp:LinkButton ID="LBtn_Add" runat="server" OnCommand="LBtn_Add_Command">添加</asp:LinkButton>
                                    <asp:LinkButton ID="LBtn_Mod" runat="server" CommandArgument='<%# Eval("Link_ID") %>'
                                        OnCommand="LBtn_Mod_Command">修改</asp:LinkButton>
                                    <asp:LinkButton ID="LBtn_Del" runat="server" CommandArgument='<%# Eval("Link_ID") %>'
                                        OnCommand="LBtn_Del_Command" OnClientClick="return confirm('删除操作不可恢复，是否继续？')">删除</asp:LinkButton>
                                </ItemTemplate>
                            </asp:TemplateField>
                            <asp:BoundField DataField="Link_DateTime" HeaderText="创建时间" SortExpression="Link_DateTime" />
                        </Columns>
                        <EmptyDataTemplate>
                            <asp:Button ID="Btn_Add" runat="server" OnCommand="LBtn_Add_Command" Text="添加新链接" />
                        </EmptyDataTemplate>
                        <EmptyDataRowStyle BackColor="#507CD1" />
                    </asp:GridView>
                    <asp:ObjectDataSource ID="ODS_ImgLinkList" runat="server" OldValuesParameterFormatString="original_{0}"
                        SelectMethod="GetImgLink" TypeName="AccessDAL.LinkTableAdapters.LinkTableAdapter">
                    </asp:ObjectDataSource>
                </td>
            </tr>
        </table>
    
    </div>
    </form>
</body>
</html>
